package com.aphrodite.io.sip.provider;

import com.aphrodite.io.sip.message.SipMethods;

/**
 * TransactionIdentifier is used to address specific transaction to the
 * SipProvider.
 */
public final class TransactionIdentifier extends Identifier {
	/** Costructs a new TransactionIdentifier based only on method name. */
	public TransactionIdentifier(String method) {
		id = method;
	}

	/**
	 * Costructs a new TransactionIdentifier based on call-id, seqn, method,
	 * sent-by, and branch.
	 */
	public TransactionIdentifier(String call_id, long seqn, String method, String sent_by, String branch) {
		if (branch == null)
			branch = "";
		if (method.equals(SipMethods.ACK))
			method = SipMethods.INVITE;
		id = call_id + "-" + seqn + "-" + method + "-" + sent_by + "-" + branch;
	}

	/** Costructs a new TransactionIdentifier. */
	public TransactionIdentifier(TransactionIdentifier i) {
		super(i);
	}
}
